package com.ruoyi.bigScreen.controller;


import com.ruoyi.bigScreen.domain.vo.BigScreenWaterSumPlanVo;
import com.ruoyi.bigScreen.service.IBigScreenWaterSumPlanVoService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Calendar;

@RestController
@RequestMapping("/threeRedLines")
public class BigScreenWaterSumPlayVoController extends BaseController {

    @Autowired
    private IBigScreenWaterSumPlanVoService waterSumPlanVoService;

    @GetMapping("/getWaterSumPlayVo")
    public AjaxResult getWaterSumPlayVo(BigScreenWaterSumPlanVo waterSumPlayVo){
        //获取当前年
        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        waterSumPlayVo.setYear(String.valueOf(year));
        BigScreenWaterSumPlanVo kZwaterSumPlanVo = waterSumPlanVoService.selectKzWaterSumPlanList(waterSumPlayVo);
//        BigScreenWaterSumPlanVo dZWaterSumPlanVo = waterSumPlanVoService.selectDnWaterSumPlanList(waterSumPlayVo);
        BigDecimal b1 = new BigDecimal("10000");//设定从万立方米换成亿立方米
        BigDecimal b2 = new BigDecimal("100000000");//实际从立方米换成亿立方米
        if (kZwaterSumPlanVo!=null){
            kZwaterSumPlanVo.setkZsurfaceWaterSum(kZwaterSumPlanVo.getkZsurfaceWaterSum().divide(b1).setScale(2,BigDecimal.ROUND_HALF_UP));
            kZwaterSumPlanVo.setkZunderWaterSum(kZwaterSumPlanVo.getkZunderWaterSum().divide(b1).setScale(2,BigDecimal.ROUND_HALF_UP));
            kZwaterSumPlanVo.setkZwaterSum(kZwaterSumPlanVo.getkZwaterSum().divide(b1).setScale(2,BigDecimal.ROUND_HALF_UP));
//            kZwaterSumPlanVo.setDNwaterSum(dZWaterSumPlanVo.getDNsurfaceWaterSum().divide(b2).setScale(2,BigDecimal.ROUND_HALF_UP));
//            kZwaterSumPlanVo.setDNsurfaceWaterSum(dZWaterSumPlanVo.getDNsurfaceWaterSum().divide(b2).setScale(2,BigDecimal.ROUND_HALF_UP));
            kZwaterSumPlanVo.setdNunderWaterSum(new BigDecimal(0));
        }
        return AjaxResult.success(kZwaterSumPlanVo);
    }
}
